package com.ds.persist.rule;

import com.value.utils.DateUtil;

import java.util.Date;

/**
 *
 * @author zhangyou
 * @date 2018/12/4
 */
public  class DateFormatRule implements IFormatRule<Date,Integer> {

    private String formatStr="";

    public DateFormatRule(String formatStr) {
        this.formatStr = formatStr;
    }

    @Override
    public Integer exeRule(Date o) {
        String dateToString = DateUtil.dateToString(o, formatStr);
        return Integer.parseInt(dateToString);
    }
}
